// 导入封装的 api 接口
import { http } from '@/utils/request'
import type { IPermissonList, IReqAddMenu } from '@/types/permissionList'

/**
 * @description 获取菜单管理页面的数据
 * @returns
 */
export const reqPermissionList = () => {
  return http<IPermissonList>('/admin/acl/permission', 'GET')
}

/**
 * @description 新增菜单 | 新增功能
 * @returns
 */
export const reqAddMenu = (param: IReqAddMenu) => {
  return http('/admin/acl/permission/save', 'POST', param)
}

/**
 * @description 编辑菜单 | 功能
 * @returns
 */
export const reqUpdateMenu = (params: IReqAddMenu) => {
  return http('/admin/acl/permission/update', 'PUT', params)
}

/**
 * @description 删除菜单 | 功能
 * @param id 菜单 + 功能 id
 * @returns
 */
export const reqDelMenu = (id: number | string) => {
  return http(`/acl/permission/remove/${id}`, 'DELETE')
}
